package com.aerfafish.spider.neo4j.repository;

import com.aerfafish.spider.neo4j.dao.Person;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author aerfafish
 * @date 2021/4/21 11:27 上午
 */
@Component
public interface PersonRepository extends Neo4jRepository<Person, Long> {

    @Query("match (person:Person{code:$code}) return person")
    List<Person> queryPersonByCode(String code);

    @Query("merge (person:Person{code: $code})")
    void save(@Param("code") String code);
}
